import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';

import 'package:get/get.dart';
import 'package:xmshop/app/services/screenAdapter.dart';
import '../controllers/product_content_controller.dart';

class SecondPageView extends GetView {
  @override
  final ProductContentController controller = Get.find();
  final Function subHeader;
  SecondPageView(this.subHeader, {super.key});
  @override
  Widget build(BuildContext context) {
    return Container(
      key: controller.gk2,
      width: ScreenAdapter.width(1080),
      color: Colors.white,
      child: Column(
        children: [
          Obx(() => subHeader()),
          Obx(
            () => controller.selectedSubTabsIndex.value == 1
                ? SizedBox(
                    width: ScreenAdapter.width(1080),
                    child: Html(
                      data: controller.pcontent.value.content ?? " ",
                      style: {
                        "body": Style(backgroundColor: Colors.white),
                        "p": Style(fontSize: FontSize.large),
                      },
                      onLinkTap: (url, attributes, element) {
                        print(url);
                      },
                    ),
                  )
                : SizedBox(
                    width: ScreenAdapter.width(1080),
                    child: Html(
                      data: controller.pcontent.value.specs ?? " ",
                      style: {
                        "body": Style(backgroundColor: Colors.white),
                        "p": Style(fontSize: FontSize.large),
                      },
                      onLinkTap: (url, attributes, element) {
                        print(url);
                      },
                    ),
                  ),
          ),
        ],
      ),
    );
  }
}
